import { Image as VanImage } from "vant";
export default {
  name: "",
  //import引入的组件需要注入到对象中才能使用
  components: { VanImage },
  data() {
    return {
      coursesId: "",
      chatStrId: "",
      chatId:"",
      answerData: [],
    };
  },
  //监听属性 类似于data概念
  computed: {},
  //监控data中的数据变化
  watch: {},
  //方法集合
  methods: {
    getRecordList() {
      let query = {
        page: this.page,
        courses_id: Number(this.coursesId)
      };
      if(this.chatId) { //h5的群主ID
        query = {...query,chat_id:this.chatId}
      }
      if (this.fun.getKey("client") === "work" || window.localStorage.getItem("client")) {
        query = { ...this.getConfig, ...query, chat_str_id: this.chatStrId };
      }
      $http.post("plugin.wechat-video-courses.frontend.controller.manage.record.on-line-member-list", query, "加载中..").then(response => {
        if (response.result == 1) {
          let res = response.data.record_list;
          let basicInfo = response.basic_info;
          this.answerData = res;
        } else {
          this.page = this.page - 1;
          this.isLoadMore = false;
          this.$dialog.alert({
            message: response.msg
          });
        }
      });
    },
  },
  //生命周期 - 创建完成（可以访问当前this实例）
  created() {
    if (this.fun.getKey("client") === "work" || window.localStorage.getItem("client")) {
      this.chatStrId = window.localStorage.getItem("chat_id") || "";
    } else {
      if(this.$route.query.groupId) {
        this.chatId = Number(this.$route.query.groupId);
      }
    }
    if (this.$route.params.id) {
      this.coursesId = this.$route.params.id;
      this.getRecordList();
    }
   
  },
  //生命周期 - 挂载完成（可以访问DOM元素）
  mounted() {},
  activated() {} //如果页面有keep-alive缓存功能，这个函数会触发
};
